package com.googlecode.spreadit.matching;

import com.googlecode.spreadit.bean.Message;

/**
 * This class is a listing of the fields which are contained in {@link Message}.
 * 
 * This class implements a fluent API (see e.g. <a
 * href="http://en.wikipedia.org/wiki/Fluent_interface#Java"
 * >http://en.wikipedia.org/wiki/Fluent_interface#Java</a>) in conjunction with
 * other classes in this package (i.e., {@link MatchField},
 * {@link MatchExpression}).
 * 
 * @author Markus L. Dechert (markus.dechert@googlemail.com)
 */
public enum MessageField {
	SUBJECT, BODY, SENDER, RECIPIENT, INCOMING_CHANNEL;

	//
	// Fluent API for the matching
	//
	public MatchField equalTo(String s) {
		return new MatchField(this, s, Comparison.EQUALS);
	}

	public MatchField contains(String s) {
		return new MatchField(this, s, Comparison.CONTAINS);
	}

	public MatchField notEqualTo(String s) {
		return new MatchField(this, s, Comparison.NOT_EQUALS);
	}

	public MatchField notContains(String s) {
		return new MatchField(this, s, Comparison.NOT_CONTAINS);
	}
}
